#
# This is the Makefile for the steamboat project
#
# Copyright (C) 2009 Philip Schlump

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.

TARGET_DB = MYSQL
RL_LIBRARY_VERSION = 5.2

SHELL = /bin/sh
RM = rm -f

srcdir = .
VPATH = .
top_srcdir = ..
BUILD_DIR = .

# Support an alternate destination root directory for package building
DESTDIR =

DEFS = -DHAVE_CONFIG_H
CC = gcc
CFLAGS = -g -O
LOCAL_CFLAGS =  -DREADLINE_LIBRARY -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' -DTARGET_DB=$(TARGET_DB)
CPPFLAGS = 

INCLUDES = -I$(srcdir) -I$(top_srcdir) -I.. -I/sw/include

CCFLAGS  = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
LDFLAGS = -g -L.. -L/sw/lib/mysql -lmysqlclient

PURIFY = 

READLINE_LIB = ../libreadline.a
HISTORY_LIB = ../libhistory.a

TERMCAP_LIB = -ltermcap

.c.o:
	${RM} $@
	$(CC) $(CCFLAGS) -c $<

EXECUTABLES = sb
OBJECTS = sb.o

all: $(EXECUTABLES)
everything: all

sb: sb.o $(READLINE_LIB)
	$(PURIFY) $(CC) $(LDFLAGS) -o $@ sb.o $(READLINE_LIB) $(TERMCAP_LIB)

clean mostlyclean:
	$(RM) $(OBJECTS)
	$(RM) $(EXECUTABLES) *.exe

distclean maintainer-clean: clean
	$(RM) Makefile

backup:
	tar -czf /tmp/steamboat.tar.gz .
	mv /tmp/steamboat.tar.gz ~/Dropbox

sb.o: sb.c

sb.o: $(top_srcdir)/readline.h
sb.o: $(top_srcdir)/history.h
